package com.example.demo.handler;

import com.example.demo.model.Simple;
import com.example.demo.model.Simple;
import com.google.gson.Gson;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Component;
import xyz.erupt.annotation.fun.DataProxy;

import java.util.Collection;
import java.util.Map;

/**
 * @author liyuepeng
 * @date 2021/1/2 21:29
 */
@Component
public class SimpleDataProxy implements DataProxy<Simple> {

    @Override
    public void addBehavior(Simple o) {
        System.out.println("addBehavior :" + new Gson().toJson(o));
    }


    @Override
    public void beforeAdd(Simple o) {
        System.out.println("beforeAdd :" + new Gson().toJson(o));
    }

    @Override
    public void afterAdd(Simple o) {
        System.out.println("afterAdd :" + new Gson().toJson(o));
    }

    @Override
    public void beforeUpdate(Simple o) {
        System.out.println("beforeUpdate :" + new Gson().toJson(o));
    }

    @Override
    public void afterUpdate(Simple o) {
        System.out.println("afterUpdate :" + new Gson().toJson(o));
    }

    @Override
    public void beforeDelete(Simple o) {
        System.out.println("beforeDelete :" + new Gson().toJson(o));
    }

    @Override
    public void afterDelete(Simple o) {
        System.out.println("afterDelete :" + new Gson().toJson(o));
    }

    @Override
    public String beforeFetch() {
        System.out.println("beforeFetch");
        return null;
    }

    @Override
    public void afterFetch(Collection<Map<String, Object>> list) {
        System.out.println("afterFetch");
    }

    @Override
    public void editBehavior(Simple o) {
        System.out.println("editBehavior :" + new Gson().toJson(o));
    }

    @Override
    public void excelExport(Workbook wb) {
        System.out.println("excelExport");
    }

    @Override
    public void excelImport(Simple o) {
        System.out.println("excelImport :" + new Gson().toJson(o));
    }

}
